package com.car.serve.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.car.commons.core.model.Result;
import com.car.serve.entity.ServeModifyLog;
import com.car.serve.exception.ServeException;
import com.car.serve.form.PageServeModifyLogForm;
import com.car.serve.service.ServeModifyLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 董旭
 * @since 2024-08-28
 */
@RestController
@RequestMapping("/serveModifyLog")
@Api(tags = "服务日志信息")
public class ServeModifyLogController {

    @Resource
    private ServeModifyLogService serveModifyLogService;

    @GetMapping("/findServeModifyLogById")
    @ApiOperation(value = "根据服务Id查询日志详情")
    public Result findServeModifyLogById(Integer serveId)throws Exception{
        ServeModifyLog byId = serveModifyLogService.getById(serveId);
        if (byId==null)throw new ServeException(3000,"服务日志不存在");
        return Result.getResult().setMsg("根据服务Id查询日志详情成功").setData(byId);
    }

    @PostMapping("/findServeModifyLogPage.pt")
    @ApiOperation(value = "分页查询")
    public Result findServeModifyLogPage(@RequestBody PageServeModifyLogForm form)throws Exception{
        Page<ServeModifyLog> serveModifyLogPage = serveModifyLogService.findServeModifyLogPage(form);
        return Result.getResult().setMsg("分页查询成功").setData(serveModifyLogPage);
    }

}

